import Vue from "vue";
import Router from 'vue-router';

Vue.use(Router)

// 避免重复push同一个路由时前端报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    name: 'router',
    routes: [{
        path: '/',
        component: () => import(/* webpackChunkName: "Home" */'../page/Home')
    }, {
        path: '/article/:article_id',
        component: () => import(/* webpackChunkName: "Article" */'../page/Article')
    }, {
        path: '/search',
        component: () => import(/* webpackChunkName: "Search" */'../page/Search')
    }]
})